
package com.oahcfly.chgame.egret;

import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.utils.Array;
import com.oahcfly.chgame.core.helper.CHFileHelper;
import com.oahcfly.chgame.egret.ui.ERes;
import com.oahcfly.chgame.egret.ui.property.BaseUIProperty;

/** http://edn.egret.com/cn/
 * 
 * CheckBox,EditText,ProgressBar,Rect
 * @author haocao */
public class Egret {

	/** 加载和解析exml文件
	 * 
	 * @param exmlPath 路径
	 * @return */
	public static Array<BaseUIProperty> loadExmlProperty (String exmlPath) {
		EXMLReader exmlReader = new EXMLReader();
		exmlReader.parseExml(exmlPath);
		return exmlReader.getUILayerProperty();
	}

	/** 自动load资源
	 * 
	 * @param pathName 资源所在目录路径 */
	public static void autoLoadRes (String pathName) {
		FileHandle[] handles = CHFileHelper.getFileHandles(pathName);
		for (FileHandle fileHandle : handles) {
			ERes.loadRes(fileHandle.name().replace(".", "_"), fileHandle.path());
		}
	}
}
